<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

//权限验证
if( Role::init() == false ){
	exit('没有权限');
}

require $_SERVER['DOCUMENT_ROOT'].'/../_interface/pages.php';

$db = new DB();

$time = time();
$online_time = 10;//多少秒内算在线
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;//当前页码
$pageSize = 20;//每页条数

//查询总记录数
$total_sql = 'select id from users where updated>'.($time - $online_time);
$total = $db->query($total_sql)->getCount();

//分页html
$page_html = Pages::page($page, $total, $pageSize, '/admin/log/online_status.php');

//查询当前页记录
$online_status_sql = 'select id,username,updated from users where updated>'.($time - $online_time).' order by created desc limit '.(($page-1)*$pageSize).','.$pageSize;
$online_status_rs = $db->query($online_status_sql)->getAll();

require template('admin/log/online_status');